package com.example.exp8;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Department_Leader extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        LocalDateTime currentDateTime = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String formattedDateTime = currentDateTime.format(formatter);
        String massage = intent.getStringExtra("notification");
        Toast.makeText(context, "系主任在" + formattedDateTime + "接收到了" + massage, Toast.LENGTH_SHORT).show();
        Log.e("aaaaa", "系主任在" + formattedDateTime + "接收到了" + massage );
//        throw new UnsupportedOperationException("Not yet implemented");
    }
}